package com.tongfusoft.web.core;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

public class SessionContext {
	private static Map<String,HttpSession> sessionMap = new HashMap<String,HttpSession>();

    public static synchronized void AddSession(HttpSession session) {
        if (session != null) {
        	sessionMap.put(session.getId(), session);
        }
    }

    public static synchronized void DelSession(HttpSession session) {
        if (session != null) {
        	sessionMap.remove(session.getId());
        }
    }

    public static synchronized HttpSession getSession(String session_id) {
        if (session_id == null) 
        return null;
        return (HttpSession) sessionMap.get(session_id);
    }
}
